package com.heima.model.threadlocal;


import com.heima.model.wemedia.pojos.WmUser;

/**
 * @author huan
 * @serial 每天一百行, 致敬未来的自己
 * @Description
 */

public class WmThreadLocalUtils {
    private final static ThreadLocal<WmUser> USER_THREAD_LOCAL = new ThreadLocal<>();

    /**
     * 设置当前线程中的用户
     * @param user 自媒体用户
     */
    public static void setUser(WmUser user) {
        USER_THREAD_LOCAL.set(user);
    }

    /**
     * 获取线程中的用户
     */
    public static WmUser getUser() {
        return USER_THREAD_LOCAL.get();
    }
}
